#ifndef TINX_TIME_H
#define TINX_TIME_H

#include <tinx/types.h>

// Standard POSIX clocks
#define CLOCK_REALTIME 0 // System-wide clock that measures real (wall-clock) time
#define CLOCK_MONOTONIC 1 // Monotonic time since some unspecified starting point
#define CLOCK_PROCESS_CPUTIME_ID 2 // High-resolution per-process timer from the CPU
#define CLOCK_THREAD_CPUTIME_ID 3 // High-resolution per-thread timer from the CPU

// Linux-specific clocks
#define CLOCK_MONOTONIC_RAW 4 // Monotonic time not subject to NTP adjustments
#define CLOCK_REALTIME_COARSE 5 // Faster but less precise version of CLOCK_REALTIME
#define CLOCK_MONOTONIC_COARSE 6 // Faster but less precise version of CLOCK_MONOTONIC
#define CLOCK_BOOTTIME 7 // Monotonic time since boot, including suspend time
#define CLOCK_BOOTTIME_ALARM 8 // Like CLOCK_BOOTTIME but can wake system from suspend
#define CLOCK_TAI 9 // International Atomic Time (TAI) clock, not subject to leap seconds

typedef struct tm_t
{
    int sec;
    int min;
    int hour;
    int mday;
    int mon;
    int year;
    int wday;
    int yday;
    int isdst;
} tm_t;

typedef struct timespec_t
{
    u32 sec;
    u32 nsec;
} timespec_t;

typedef struct timespec64_t
{
    u64 sec;
    u64 nsec;
} timespec64_t;

time_t ktime();

#endif